package cn.edu.swpu.sims.model;

import lombok.Data;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author 码之泪殇
 * @date 2020/9/11 10:27
 * 到达胜利之前，无法回头
 * 描述: 管理员信息实体
 */
public class Admin implements Serializable {
    /**
     * ID
     */
    private int id;
    /**
     * 用户名
     */
    private String username;
    /**
     * 密码
     */
    private String password;
    /**
     * 姓名
     */
    private String name;
    /**
     * 邮箱
     */
    private String email;
    /**
     * 角色
     */
    private String role;

    public Admin() {
    }

    /**
     * 构造
     * @param username 用户名
     * @param password 密码
     */
    public Admin(String username, String password) {
        this.username = username;
        this.password = password;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    @Override
    public String toString() {
        return "Admin{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", name='" + name + '\'' +
                ", email='" + email + '\'' +
                ", role='" + role + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Admin admin = (Admin) o;
        return id == admin.id &&
                username.equals(admin.username) &&
                password.equals(admin.password) &&
                name.equals(admin.name) &&
                email.equals(admin.email) &&
                role.equals(admin.role);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, username, password, name, email, role);
    }
}
